import { defineStore } from "pinia"

export const useMainStore = defineStore('userStore', {
  // 状态
  state: () => ({
    mesStates: {},
    comments: {},
  }),
  // 同步方法
  actions: {
    setMesStates(MesId, data) {
      this.mesStates[MesId] = data
    },
    isFeedBack(MesId, ip) {
      return this.mesStates[MesId]?.data.findIndex((item) => {
        return item.userId == ip
      }) >= 0
        ? true
        : false
    },
    getMesStates(MesId) {
      return this.mesStates[MesId] || {}
    },
  },
  // 计算属性
  getters: {
  },
})

 